/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package generator_pism_libet;


import java.sql.*;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author A
 */
public class Customer_Data {
    private Integer i = 0, counter = 0;

    String rownames[][];

    public Customer_Data(){
         
    Properties prop = new Properties();
    prop.put("charSet", "windows-1250"); 
    prop.put("user", "");
    prop.put("password", "");
        
        try {

        
        String myDB = "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=./Klienci.xls;"
        + "DriverID=22;READONLY=false";
        Connection con = DriverManager.getConnection(myDB, prop);
        Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
        ResultSet.CONCUR_READ_ONLY);

         ResultSet rs = stmt.executeQuery("select * from [Arkusz$]");
         
         
         
         
            while(rs.next()){
               counter++;
            }

             rownames=  new String[counter][2] ;
                rs.beforeFirst();
            
                while(rs.next()){
                                     

                  rownames[i][0]=rs.getString(1);
                   rownames[i][1]=rs.getString(2);
                   i++;
                
                }

       
        
        Generator g = new Generator();
        g.setRownames(rownames);
        } 
         
        catch (Exception ex) {
            Logger.getLogger(Customer_Data.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        

}
}